package com.medic.util;

import java.util.HashMap;
import java.util.List;
import java.util.Properties;

import com.medic.entity.group.pain.Medic;
import com.medic.entity.group.pain.SikerInfo;

/**
 * 缓存帮助类
 * 
 * @author Mr.zhang
 *
 */
public class CacheUtil {

	/**
	 * 在服务器启动之时就读取所有配置文件放入改对象中，之后使用直接用该对象读取即可。
	 */
	private static Properties config;

	/**
	 * 微信的access_token缓存
	 */
	private static String accessToken;

	/**
	 * 微信jsapi_ticket缓存
	 */
	private static String jsapiTicket;

	/**
	 * 回复咨询每页大小
	 */
	private static int topic_pagesize;
	/**
	 * 查询角色每页大小
	 * 
	 * @return
	 */
	private static int role_pagesize;

	/**
	 * 回复每页大小
	 */
	private static int reply_pagesize;
	/**
	 * 任务每页大小
	 */
	private static int task_pagesize;

	/**
	 * 用药提醒信息的缓存
	 */
	private static HashMap<Integer, Medic> medics;

	private static HashMap<String, SikerInfo> sikerinfos;

	public static HashMap<String, SikerInfo> getSikerinfos() {
		return sikerinfos;
	}

	public static void setSikerinfos(HashMap<String, SikerInfo> infos) {
		sikerinfos = infos;
	}

	public static Properties getConfig() {
		return config;
	}

	public static void setConfig(Properties config) {
		CacheUtil.config = config;
	}

	public static String getAccessToken() {
		return accessToken;
	}

	public static void setAccessToken(String accessToken) {
		CacheUtil.accessToken = accessToken;
	}

	public static String getJsapiTicket() {
		return jsapiTicket;
	}

	public static int getTopic_pagesize() {
		return topic_pagesize;
	}

	public static void setTopic_pagesize(int topicPagesize) {
		topic_pagesize = topicPagesize;
	}

	public static int getReply_pagesize() {
		return reply_pagesize;
	}

	public static void setReply_pagesize(int replyPagesize) {
		reply_pagesize = replyPagesize;
	}

	public static void setJsapiTicket(String jsapiTicket) {
		CacheUtil.jsapiTicket = jsapiTicket;
	}

	public static int getRole_pagesize() {
		return role_pagesize;
	}

	public static void setRole_pagesize(int rolePagesize) {
		role_pagesize = rolePagesize;
	}

	public static int getTask_pagesize() {
		return task_pagesize;
	}

	public static void setTask_pagesize(int task_pagesize) {
		CacheUtil.task_pagesize = task_pagesize;
	}

	public static HashMap<Integer, Medic> getMedics() {
		return medics;
	}

	public static void setMedics(List<Medic> medics) {
		CacheUtil.medics = new HashMap<Integer, Medic>();
		for (Medic medic : medics) {
			CacheUtil.medics.put(medic.getMedicId(), medic);
		}
	}

}
